"""首页"""
import allure
from selenium.webdriver.common.by import By

from advanced.page_objects.base_page import BasePage
from advanced.utils.log_utils import logger


class HomePage(BasePage):
    __MENU_MALL_MANAGE = (By.XPATH, '//*[text()="商品管理"]')
    __MENU_PRODUCT_CATEGORY = (By.XPATH, '//*[text()="商品列表"]')
    """系统首页：进入商品类目"""

    @allure.step("进入商品上架页面")
    def go_to_category(self):
        logger.info("进入商品上架页面")
        # 点击菜单“商品管理”
        self.do_find(self.__MENU_MALL_MANAGE).click()
        # 点击菜单“商品列表”
        self.do_find(self.__MENU_PRODUCT_CATEGORY).click()

        # ==》商品列表页面
        from advanced.page_objects.category_list_page import CategoryListPage
        return CategoryListPage(self.driver)
